package com.example.goodpet.db.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.example.goodpet.db.entity.GoodpetHistory;
import com.example.goodpet.db.entity.TieziHistory;

import java.util.List;
@Dao
public interface TieziHistoryDAO {
    //插入单个
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(TieziHistory tieziHistory);

    //清空
    @Query("delete from tiezi_history where userId = :userId")
    void delete(long userId);
    //删除单个
    /**
     * 删除单个浏览记录
     * @param userId
     * @param tieziId
     */
    @Query("delete from tiezi_history where userId = :userId and tieziId = :tieziId")
    void deleteByUserIdAndTieziId(long userId,long tieziId);
    //查询所有
    @Query("select * from tiezi_history where userId = :userId ORDER BY postdate DESC")
    List<TieziHistory> selectListHistory(long userId);







}
